{% extends 'index.html' %}

{% block content %}
    <div class="account">
        <div class="title">
            用户登录
        </div>
        <form method="post" novalidate>
            {% csrf_token %}
            {% for field in form %}

                <div class="form-group">
                    <label for="{{ field.id_for_label }}" style="margin-top: 10px;">{{ field.label }}</label>
                    {{ field }}
                    <span>{{ field.errors.0 }}</span>
                </div>

            {% endfor %}

            <div class="row" style="margin-top: 10px;">
                <div class="col-xs-3">
                    <input type="submit" class="btn btn-primary" value="登 录">
                </div>
            </div>
        </form>
        <!-- 新增跳转注册页面的按钮 -->
        <div class="row" style="margin-top: 10px;">
            <div class="col-xs-3">
                <a href="{% url 'register' %}" class="btn btn-secondary">注 册</a>
            </div>
        </div>
    </div>

{% endblock %}

{% block js %}
    <script>
        $(function () {
                $('#imageCode').click(function () {
                    var old = $(this).attr('src');
                    $(this).attr('src', old + '?');
                })
            }
        )
    </script>
{% endblock %}